/**
 * Copyright (C)  2011  chen wei hua.
 * Permission is granted to copy, distribute and/or modify this document
 * under the terms of the GNU Free Documentation License, Version 2.0
 * or any later version published by the Free Software Foundation;
 * with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
 * A copy of the license is included in the section entitled "GNU Free Documentation License".
 */
package com.javaeye.procurement.web;

import com.javaeye.procurement.dto.MaterialsReceiveOrder;
import com.javaeye.procurement.service.IMaterialsReceiveInStoreService;

public class MaterialsReceiveInStoreAction extends MaterialsReceiveOrderAction {

	/**
	 * 
	 */
	private static final long serialVersionUID = -7408989332825417843L;
	
	private IMaterialsReceiveInStoreService receiveInStoreService;

	public void setReceiveInStoreService(
			IMaterialsReceiveInStoreService receiveInStoreService) {
		this.receiveInStoreService = receiveInStoreService;
	}

	/**
	 * 查询需要入库的出货单列表
	 * @return
	 * @throws Exception
	 */
	public String queryMaterialsReceiveInStoreList() throws Exception {
		getCondition().setStatus(new Integer[]{MaterialsReceiveOrder.ORDER_STATES_CHECK_QUALIFIED, 
				MaterialsReceiveOrder.ORDER_STATES_CREATED_UNQUALIFIED});
		return queryMaterialsReceiveOrderList();
	}
	
	/**
	 * 查询用于入库
	 * @return
	 * @throws Exception
	 */
	public String queryMaterialsReceiveForInStore() throws Exception {
		return queryMaterialsReceiveOrderInfo();
	}
	
	/**
	 * 保存结果
	 * @return
	 * @throws Exception
	 */
	public String saveOrderInStore() throws Exception {
		MaterialsReceiveOrder order = 
			materialsReceiveOrderService.getMaterialsReceiveOrderInfo(getOrderId());
		receiveInStoreService.saveInStoreResult(order);
		return SUCCESS;
	}
}
